package laixueit.dao;

import laixueit.domain.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author laixueit_杜
 * @site www.laixueit.com
 * @create 2020-04-05 13:07
 */
public interface IUserDao {

    @Select("select * from user")
    public List<User> findAll();

    @Insert("insert into user(username) value(#{username})")
    @Options(keyColumn = "id" ,useGeneratedKeys = true,keyProperty = "id")
    public void addUser(User user);

    @Delete("delete from user where id = #{id}")
    public void del(Integer id);

    @Update("update user set username=#{username},address=#{address}\n" +
            "        where id =#{id}")
    public void updateUser(User user);
}
